﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Autorent.Mobile.ViewModels;

namespace Autorent.Mobile.Views
{
    public partial class OrderInfoView : UserControl
    {
        private string _vehicleId;
        private OrderInfoViewModel _orderInfoViewModel;

        public OrderInfoView(string vehicleId)
        {
            InitializeComponent();
            this._vehicleId = vehicleId;
            this.DataContext = this.OrderInfoViewModel;
        }



        public OrderInfoViewModel OrderInfoViewModel
        {
            get
            {
                if (this._orderInfoViewModel == null)
                    this._orderInfoViewModel = new OrderInfoViewModel(this._vehicleId);
                this._orderInfoViewModel.SuccessUpdate += new ViewModels.OrderInfoViewModel.SuccessUpdateHandler(OrderInfoViewModel_SuccessUpdate);
                return this._orderInfoViewModel;
            }
        }



        private void OrderInfoViewModel_SuccessUpdate()
        {
            this.Content = new TextBox() { Text = "Order was successfully saved" };
        }
    }
}
